<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    // 字符：非空字符为true，空字符为false
    console.log( Boolean( "" ) );
    console.log( Boolean( " " ) );
    console.log( Boolean( "hello" ) );
    console.log( Boolean( "false" ) );
    console.log("--------")
    // 数值：非0为true，0为false
    console.log( Boolean( 0 ) );
    console.log( Boolean( 3 ) );
    console.log( Boolean( -3 ) );
    console.log( Boolean( 3.14 ) );
    console.log("--------")
    // 对象，数组，函数都是true
    console.log( Boolean( {} ) );
    console.log( Boolean( {name:false} ) );
    console.log( Boolean( [] ) );
    console.log( Boolean( [false] ) );
    console.log( Boolean( function(){} ) );
    console.log("--------")
    // undefined和null和NaN都是false
    console.log( Boolean( undefined ) );
    console.log( Boolean( null ) );
    console.log( Boolean( NaN ) );
    
</script>
</html>